package com.gzhryc.shared_device.oem.code.user.dao;

import com.gzhryc.jdbc.BaseDao;
import com.gzhryc.jdbc.Conditions;
import com.gzhryc.jdbc.Query;
import com.gzhryc.shared_device.oem.code.user.dao.db.UserWallet;

import java.sql.SQLException;

public class UserWalletDao extends BaseDao<UserWallet> {

    public UserWalletDao(String jdbcKey){
        super(jdbcKey);
    }

    public Long sumMoneyByConditions(Conditions conditions) throws SQLException {
        String sql = "SELECT SUM(money) FROM " + this.tableName;
        Query query = new Query(sql);
        query.appendSql(conditions.toSql(query.getParams(),true));
        return jdbcHelper.getFirstField(query,Long.class);
    }
}
